$(document).ready(function(){
	var contentid = $("input[name='contentid']").val();
	var str="";
	var pages="";
	var url = window.location.pathname;
	var strurl = url.substring(url.length-7,url.length);
	var app_path = app_path ? app_path : 'http://www.ifensi.com/';
})


/*赞操作*/ 
function favour(commentid){
	 $.getJSON(app_path+"c_favour.html?callback=?",{'commentid':commentid},function(json){ 
		if(json == 1) {
			$('#support_'+commentid).html(parseInt($('#support_'+commentid).html())+1);
		}
	 });
} 

function ding(id) {
	$.getJSON(app_path+"c_ding.html?callback=?",{'id':id,'type':1},function(json){
		if(json != 1) {
			alert('每天只能点击一次');
			$(".di").hide();
		} else {
			// $(this).siblings(".di").css('display','block');
		var icon = $(".ding").siblings(".di");
		icon.css("visibility","visible").animate({"left":icon.position().left+icon.width()},400);
		icon.find(".di_left a").text("+1");
		setTimeout(function(){
			icon.slideUp();
		},4000);
		}
	 });
}

function cai(id) {
	$.getJSON(app_path+"c_ding.html?callback=?",{'id':id,'type':2},function(json){ 
		if(json != 1) {
			alert('每天只能点击一次');
			$(".ca").hide();
		} else {
			var step = $('.cai').siblings(".ca");
			step.css("visibility","visible").slideDown(300);
			step.find("a").text("+1");
			setTimeout(function(){
				step.slideUp();
			},2000);
		}
	 });
}

function onover(id) {
	$.getJSON(app_path+"s_star.html?callback=?",{'id':id},function(data){ 
		if(data) {
			if(data["thumb"]) {
				str = '<div class="c_left">'+
						'<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/"><img src="'+data["thumb"]+'" alt="" width="88" height="130" /></a>'+
						 '</div>'+
						 '<div class="c_right">'+
							 '<h4><a target="_blank" href="http://star.ifensi.com/s'+data["id"]+'/">'+data["title"]+'</a></h4>'+
							 '<div class="c_list">'+
								 '<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/dongtai/">最新动态</a>'+
								 '<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/xiezhen/">最美写真</a>'+
								 '<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/ziliao/">个人档案</a>'+
								 '<a class="jia" href="javascript:;">加入粉团</a>'+
								 '<span class="ma"></span>'+
							'</div>'+
						'</div>';
			} else {
				str = '<div class="c_left">'+
						'<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/"><img src="/statics/images/nophoto.gif" alt="" width="88" height="130" /></a>'+
						 '</div>'+
						 '<div class="c_right">'+
							 '<h4><a target="_blank" href="http://star.ifensi.com/s'+data["id"]+'/">'+data["title"]+'</a></h4>'+
							 '<div class="c_list">'+
								 '<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/dongtai/">最新动态</a>'+
								 '<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/xiezhen/">最美写真</a>'+
								 '<a target="_blank" href="http://star.ifensi.com/s'+data['id']+'/ziliao/">个人档案</a>'+
								 '<a class="jia" href="javascript:;">加入粉团</a>'+
								 '<span class="ma"></span>'+
							'</div>'+
						'</div>';
			}
			
			$('#star_com').html(str);	
			$(".jia").click(function(){
				$(this).siblings(".ma").toggle();	
			});

			$(".jia").hover(function(){
				$(this).siblings(".ma").hide();	
			},function(){
				$(this).siblings(".ma").hide();	
			});
			
		}
	 });
}
 
 function exit_music(starname) {  
		var result="";  
		$.ajax({
			type: "GET",
			url: "http://bd.kuwo.cn/mpage/api/artistSongs?pn=0&rn=5&bdfrom=fensi",
			data: {'name':starname,'sortby':1},
			datatype:'json',
			success: function(json){
				var obj=eval('('+json+')');     //获取json中的个数  
			 
				if(obj.musiclist){
	 
					result="http://www.kuwo.cn/mingxing/"+starname+"/music.htm?bdfrom=fensi"; 
					 
				}else{ 
					alert("此明星还没有歌曲哦！"); 
				 
				}
			}
		});  
			window.open("http://www.kuwo.cn/mingxing/"+starname+"/music.htm?bdfrom=fensi","_blank");
		 
	 
}


